<link href="{{ asset('/css/countdown.css') }}" rel="stylesheet" type="text/css">
<script src="{{ asset('/js/jquery.countdown.js') }}" type="text/javascript"></script>
<div class="modal fade bs-example-modal-lg" id="examination" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">@if(Auth::user()) 应聘考试 @else 系统提示 @endif</h4>
            </div>
            <div class="modal-body clearfix">
                @if(Auth::user())
                <form id='examForm'>
                    @foreach($questions as $key=>$ques)
                    <div class="form-group clearfix">
                        <div class="col-xs-12">
                            {{$key+1}}、 {{$ques->title}}
                        </div>
                        <div class="col-xs-12 margin-l-20 margin-t-10">
                            {!! $ques->options !!}
                        </div>
                        <div class="col-xs-12 margin-l-20 margin-t-10">
                            @if($ques->question_type == 1)
                            @if($ques->questions_num==1)
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==2)
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==3)
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==4)
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="question_{{$ques->id}}[]" value="D">&nbsp;&nbsp;&nbsp;D</label>&nbsp;&nbsp;&nbsp;
                            @endif
                            @else
                            @if($ques->questions_num==1)
                            <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==2)
                            <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==3)
                            <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                            @elseif($ques->questions_num==4)
                            <label><input type="radio" name="question_{{$ques->id}}" value="A">&nbsp;&nbsp;&nbsp;A</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="B">&nbsp;&nbsp;&nbsp;B</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="C">&nbsp;&nbsp;&nbsp;C</label>&nbsp;&nbsp;&nbsp;
                            <label><input type="radio" name="question_{{$ques->id}}" value="D">&nbsp;&nbsp;&nbsp;D</label>&nbsp;&nbsp;&nbsp;
                            @endif
                            @endif
                        </div>
                    </div>
                    @endforeach
                    {!! csrf_field() !!}
                    <input type="hidden" name="ehtime" value="1">
                    <input type="hidden" name="company_id" value="0">
                    <input type="hidden" name="job_id" value="{{$result->id}}">
                    <input type="hidden" name="app" value="{{$app}}">
                    <input type="hidden" name="examination_id" value="{{$result->examination->id}}">
                </form>
                @if(!empty($result->examination->times))
                <div class="float-r" id="counterdown"></div>
                <script type="text/javascript">
                $(function(){
                    var times = '{{$result->examination->times}}';
                    var setimes = times*60-1;
                	var hour = Math.floor((setimes / 3600) % 24);
                	var minite = Math.floor((setimes / 60) % 60);
                	var second = Math.floor(setimes % 60);
                	$('#examination').on('shown.bs.modal', function () {
                		 var html = $('#counterdown').html();
                		 if(html.lenght <= 0 || html == ''){
                             $('#counterdown').countdown({
                                image: '{{asset("/images/digits.png")}}',
                                startTime: hour+":"+minite+":"+second,
                                timerEnd: function(){
                                	deliveryResume('/member/examination/employ','examForm');
                                	$('#examination').modal('hide')
                    			},
                                format: 'hh:mm:ss'
                              });
                		 }
            		});
                });
                </script>
                @endif
                @else
                <div class="font-16 text-center"><font color="red">您当前尚未登录，请先登录！</font></div>
                @endif
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" id="submittags" data-dismiss="modal">关闭</button>
                @if(Auth::user())<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="deliveryResume('/member/examination/employ','examForm')">提交</button>@endif
            </div>
        </div>
    </div>
</div>